def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    return True

def nearest_prime_number(num):
    if num.isdigit() and len(num) == 3:
        num = int(num)
        while True:
            if is_prime(num):
                return num
            num += 1
    else:
        return "Wrong input"

words = input().split()
number = ""
for word in words:
    if word == "zero":
        number += "0"
    elif word == "one":
        number += "1"
    elif word == "two":
        number += "2"
    elif word == "three":
        number += "3"
    elif word == "four":
        number += "4"
    elif word == "five":
        number += "5"
    elif word == "six":
        number += "6"
    elif word == "seven":
        number += "7"
    elif word == "eight":
        number += "8"
    elif word == "nine":
        number += "9"

print(nearest_prime_number(number))
